package master.vt;


import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

public class P1 extends ListActivity {
    /** Called when the activity is first created. */
	private ListView listview;
	ListAdapter listAdapter= new ListAdapter();
	private NewsXmlParser parser = null; 
	int length;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.p1);
        parser = new NewsXmlParser();
		length = parser.getSlideImages().length;
        listview=getListView();
        listview.setDivider(null);
        listview.setDividerHeight(0);
        listview.setAdapter(listAdapter);
    }
    class ListAdapter extends BaseAdapter{

		public int getCount() {
			// TODO Auto-generated method stub
			return 10;
		}

		public Object getItem(int position) {
			// TODO Auto-generated method stub
			return position;
		}

		public long getItemId(int position) {
			// TODO Auto-generated method stub
			return position;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			LayoutInflater inflater = LayoutInflater.from(P1.this);
			View view = inflater.inflate(R.layout.photo_list, null);
			TextView photo_title = (TextView)view.findViewById(R.id.photo_title);
			TextView photo_number = (TextView)view.findViewById(R.id.photo_number);
			photo_number.setText(""+length);
			ImageView photo_logo = (ImageView)view.findViewById(R.id.photo_logo);
			ImageView photo_image = (ImageView)view.findViewById(R.id.photo_image);
			
			return view;
		}
	}
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
		Intent intent = new Intent();
		intent.setClass(P1.this, PhotodetailActivity.class);
		startActivity(intent);
		super.onListItemClick(l, v, position, id);
    }
    
    
}